<?php
//=======================================
//###################################
// Kayako Web Solutions
//
// Source Copyright 2001-2004 Kayako Web Solutions
// Unauthorized reproduction is not allowed
// License Number: $%LICENSE%$
// $Author: vshoor $ ($Date: 2007/05/25 05:35:54 $)
// $RCSfile: impex_step1.php,v $ : $Revision: 1.7 $ 
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
//###################################
//=======================================

if (!defined("INSWIFT")) {
	trigger_error("Unable to process $PHP_SELF", E_USER_ERROR);
}

displayHeader();

displayValue("Product:", SWIFTPRODUCT);
displayValue("File Version:", SWIFTVERSION);
displayValue("Build Date:", BUILDDATE);
displayValue("Build Type:", BUILDTYPE);
displayStatus("Verifying Database Connection", $dbCore->connected, $dbCore->fetchLastError());

if ($dbCore->connected)
{
	require_once ("./setup/steps/global_systemchecks.php");

	if ($_SWIFT["setupfailed"] != true)
	{
		// All Succeeded, Try to authenticate user
		$_version = $dbCore->queryFetch("SELECT * FROM `". TABLE_PREFIX ."settings` WHERE `section` = 'core' AND `vkey` = 'version';");
		displayValue("Current Version:", "<font color='red'>".$_version["data"]."</font>");

		displayField(SWIFTPRODUCT." Username", "username", $_POST["username"], "text");
		displayField("Password", "password", $_POST["password"], "password");

		echo "<BR />";

		$productselect = '<select name="product">
		<option value="esupport" selected>eSupport v2.3.5</option>
		<option value="cerberus">Cerberus Helpdesk v2.6.1</option>
		<option value="cerberus27">Cerberus Helpdesk v2.7</option>
		<option value="perldesk">PerlDesk v1.8</option>
		<option value="perldesk2">PerlDesk v2.27</option>
		<option value="supporttrio">SupportTrio v2.1</option>
		<option value="deskpro">DeskPro v2.0.1</option>
		<option value="sitepanel3">Sitepanel v3</option>
		</select>';
		displayFieldCustom("Product", $productselect);

		displayField("Database Host", "dbhostname", $_POST["dbhostname"], "text");
		displayField("Database Name", "dbname", $_POST["dbname"], "text");
		displayField("Database Username", "dbusername", $_POST["dbusername"], "text");
		displayField("Database Password", "dbpassword", $_POST["dbpassword"], "text");

		?><input type="hidden" name="hashfilename" value="<?php echo "impexhash_".buildHash(); ?>"><?

		if ($_SWIFT["errormsg"] == true)
		{
			displayError($_SWIFT["errormsg"]);
		}
	} else {
		$_SWIFT["error"] = true;
	}
} else {
	$_SWIFT["error"] = true;
}

displayFooter();
?>